﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Estimate.Common.Repository;
using Estimate.Common.Entity;
using Estimate.Common.DBFieldTypes;
using Estimate.Common.Estimate;

namespace Estimate.Common.DBHealth
{
   public class CheckForeDataKeys
    {
        static ForeSpanType[] ShortSpans = new ForeSpanType[]{
                                                    ForeSpanType.FD00_12,  ForeSpanType.FD00_24,  ForeSpanType.FD12_24, 
                                                    ForeSpanType.FD24_36,  ForeSpanType.FD24_48,  ForeSpanType.FD36_48, 
                                                    ForeSpanType.FD48_60,  ForeSpanType.FD48_72,  ForeSpanType.FD60_72
                                                  };
        static ForeSpanType[] MiddleSpans = new ForeSpanType[]{
                                                     
                                                    ForeSpanType.FD72_84,  ForeSpanType.FD72_96,  ForeSpanType.FD84_96,
                                                    ForeSpanType.FD96_108, ForeSpanType.FD96_120, ForeSpanType.FD108_120, 
                                                    ForeSpanType.FD120_132,ForeSpanType.FD120_144,ForeSpanType.FD132_144, 
                                                    ForeSpanType.FD144_156,ForeSpanType.FD144_168,ForeSpanType.FD156_168
                                                  };
        static ForeSpanType[] Short24Spans = new ForeSpanType[] { ForeSpanType.FD00_24, ForeSpanType.FD24_48, ForeSpanType.FD48_72 };
        static ForeSpanType[] Middle24Spans = new ForeSpanType[] { ForeSpanType.FD72_96, ForeSpanType.FD96_120, ForeSpanType.FD120_144, ForeSpanType.FD144_168 };

        static ForeSendpointType[] CityForeSendpoints1 = new ForeSendpointType[] { ForeSendpointType.H05, ForeSendpointType.H06, ForeSendpointType.H10, ForeSendpointType.H16 };
        static ForeSendpointType[] CityForeSendpoints2 = new ForeSendpointType[] { ForeSendpointType.H06, ForeSendpointType.H10, ForeSendpointType.H16 };
        static ForeSendpointType[] SiteForeSendpoints = new ForeSendpointType[] { ForeSendpointType.H06, ForeSendpointType.H16 };
        static ForeSendpointType[] ZytForeSendpoints = new ForeSendpointType[] { ForeSendpointType.H06, ForeSendpointType.H15,ForeSendpointType.H16 };

        static ForeFactorType[] ForeFactors = new ForeFactorType[] { ForeFactorType.wth };


        //, List<string> WthCheckKeys, List<ForeSpanType> Spans, List<ForeSendpointType> Sendpoints
        public static List<string> GetWthCheckKeys(ForeDataType DataType)
        {
            List<string> WthCheckKeys = new List<string>(72);

            switch (DataType)
            {
                case ForeDataType.city:
                    foreach (ForeSpanType span in ShortSpans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in CityForeSendpoints1)
                        {
                            //Sendpoints.Add(sendpoint);
                            WthCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        }
                    }
                    foreach (ForeSpanType span in MiddleSpans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in CityForeSendpoints2)
                        {
                            //if (!Sendpoints.Contains(sendpoint)) Sendpoints.Add(sendpoint);
                            WthCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        }
                    }

                    break;

                case ForeDataType.site:
                    foreach (ForeSpanType span in ShortSpans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in SiteForeSendpoints)
                        {
                            //Sendpoints.Add(sendpoint);
                            WthCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        }
                    }
                    foreach (ForeSpanType span in MiddleSpans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in SiteForeSendpoints)
                            WthCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        
                    }

                    break;

                case ForeDataType.zyt:
                     foreach (ForeSpanType span in ShortSpans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in ZytForeSendpoints)
                        {
                            //Sendpoints.Add(sendpoint);
                            WthCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        }
                    }
                    foreach (ForeSpanType span in MiddleSpans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in ZytForeSendpoints)
                            WthCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                    }

                  
                    break;
            }

            return WthCheckKeys;
        }

        public static List<string> GetTempCheckKeys(ForeDataType DataType)
        {

            List<string> TempCheckKeys = new List<string>(24);

            switch (DataType)
            {
                case ForeDataType.city:
                    
                    foreach (ForeSpanType span in Short24Spans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in CityForeSendpoints1)
                        {
                            //Sendpoints.Add(sendpoint);
                            TempCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        }
                    }
                    foreach (ForeSpanType span in Middle24Spans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in CityForeSendpoints2)
                            TempCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                    }

                    break;

                case ForeDataType.site:

                    foreach (ForeSpanType span in Short24Spans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in SiteForeSendpoints)
                        {
                            //Sendpoints.Add(sendpoint);
                            TempCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        }
                    }
                    foreach (ForeSpanType span in Middle24Spans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in SiteForeSendpoints)
                            TempCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                    }
                    break;

                case ForeDataType.zyt:
                   
                    foreach (ForeSpanType span in Short24Spans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in ZytForeSendpoints)
                        {
                            //Sendpoints.Add(sendpoint);
                            TempCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                        }
                    }
                    foreach (ForeSpanType span in Middle24Spans)
                    {
                        //Spans.Add(span);
                        foreach (ForeSendpointType sendpoint in ZytForeSendpoints)
                            TempCheckKeys.Add(span.ToString() + "-" + sendpoint.ToString());
                    }
                    break;
            }

            return TempCheckKeys;
        }
    }

   
}
